home *** CD-ROM | disk | FTP | other *** search
/ Hackers Underworld 2: Forbidden Knowledge / Hackers Underworld 2: Forbidden Knowledge.iso / VIRUS / DROPSY.ASM < prev    next >
Assembly Source File  |  1992-08-13  |  5KB  |  100 lines

  1. ;DROPSY TEXT effect for Nowhere Man's VCL - TASM will assemble as is using
  2. ;VCL recommended switches.  When screen is thoroughly dropsie'd, that is all
  3. ;letters have fallen to a single line across the bottom of the monitor,
  4. ;the routine will exit to DOS and restore the command prompt. I excerpted
  5. ;quite a bit of this from some public domain video routines optimized for
  6. ;the accursed a86 assembler and reworked the whole magilla until TASM
  7. ;wouldn't choke when swallowing the source. It attempts to meet 
  8. ;minimum requirements for VCL formatting. Heck, this is a nice routine
  9. ;to have at your fingertips; you gotta admit a CASCADE-virus-like effect 
  10. ;is always something people wanna see. And it's commented up the 
  11. ;kazoo, one of the features I like best about VCL code. Hope you find
  12. ;it useful. -URNST KOUCH
  13.  
  14. code           segment byte public
  15.                assume  cs:code,ds:code,es:code,ss:code
  16.                org     0100h
  17.  
  18.                jmp  Start
  19.  
  20. main           proc near
  21.  
  22. Row            dw   24             ;Rows to do initially
  23.  
  24.                                    ;First, get current video mode and page.
  25. Start:         mov  cx,0B800h      ;color display, color video mem for page 1
  26.                mov  ah,15          ;Get current video mode
  27.                int  10h
  28.                cmp  al,2           ;Color?
  29.                je   A2             ;Yes
  30.                cmp  al,3           ;Color?
  31.                je   A2             ;Yes
  32.                cmp  al,7           ;Mono?
  33.                je   A1             ;Yes
  34.                int  20h            ;No,quit
  35.  
  36.                                    ;here if 80 col text mode; put video segment in ds.
  37. A1:            mov  cx,0A300h      ;Set for mono; mono videomem for page 1
  38. A2:            mov  bl,0           ;bx=page offset
  39.                add  cx,bx          ;Video segment
  40.                mov  ds,cx          ;in ds
  41.  
  42.                                    ;start dropsy effect
  43.                xor  bx,bx          ;Start at top left corner
  44. A3:            push bx             ;Save row start on stack
  45.                mov  bp,80          ;Reset column counter
  46.                                    ;Do next column in a row.
  47. A4:            mov  si,bx          ;Set row top in si
  48.                mov  ax,[si]        ;Get char & attr from screen
  49.                cmp  al,20h         ;Is it a blank?
  50.                je   A7             ;Yes, skip it
  51.                mov  dx,ax          ;No, save it in dx
  52.                mov  al,20h         ;Make it a space
  53.                mov  [si],ax        ;and put on screen
  54.                add  si,160         ;Set for next row
  55.                mov  di,cs:Row      ;Get rows remaining
  56. A5:            mov  ax,[si]        ;Get the char & attr from screen
  57.                mov  [si],dx        ;Put top row char & attr there
  58. A6:            call Vert           ;Wait for 2 vert retraces
  59.                mov  [si],ax        ;Put original char & attr back
  60.                                    ;Do next row, this column.
  61.               add  si,160          ;Next row
  62.               dec  di              ;Done all rows remaining?
  63.               jne  A5              ;No, do next one
  64.               mov  [si-160],dx     ;Put char & attr on line 25 as junk
  65.                                    ;Do next column on this row.
  66. A7:           add  bx,2            ;Next column, same row
  67.               dec  bp              ;Dec column counter; done?
  68.               jne  A4              ;No, do this column
  69. ;Do next row.
  70. A8:           pop  bx              ;Get current row start
  71.               add  bx,160          ;Next row
  72.               dec  cs:Row          ;All rows done?
  73.               jne  A3              ;No
  74. A9:           mov  ax,4C00h  
  75.               int  21h             ;Yes, quit to DOS with error code
  76.  
  77.                                    ;routine to deal with snow on CGA screen.
  78. Vert:         push ax
  79.               push dx
  80.               push cx              ;Save all registers used
  81.               mov  cl,2            ;Wait for 2 vert retraces
  82.               mov  dx,3DAh         ;CRT status port
  83. F1:           in   al,dx           ;Read status
  84.               test al,8            ;Vert retrace went hi?
  85.               je   F1              ;No, wait for it
  86.               dec  cl              ;2nd one?
  87.               je   F3              ;Yes, write during blanking time
  88. F2:           in   al,dx           ;No, get status
  89.               test al,8            ;Vert retrace went low?
  90.               jne  F2              ;No, wait for it
  91.               jmp  F1              ;Yes, wait for next hi
  92. F3:           pop  cx
  93.               pop  dx
  94.               pop  ax              ;Restore registers
  95.               ret                  ;and return
  96.               
  97.               main   endp
  98.               code   ends
  99.               end    main
  100.